﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package blit {
    import Engine.Classes.*;
    import flash.geom.*;
    import de.polygonal.ds.*;

    public class RenderGrid {

        private var m_width:Number;
        private var m_height:Number;
        private var m_xstep:Number;
        private var m_ystep:Number;
        private var m_div:Number;
        private var m_dirtyRects:DLinkedList;
        private var m_intersectingRects:DLinkedList;
        private var m_numIntersectingRects:int;
        private var m_created:Boolean = false;

        public function RenderGrid(){
            this.m_dirtyRects = new DLinkedList();
            this.m_intersectingRects = new DLinkedList();
            super();
        }
        public function init(_arg1:Point, _arg2:int, _arg3:int, _arg4:int):void{
            this.m_created = true;
        }
        public function clearGrid():void{
            this.m_dirtyRects.clear();
            this.m_intersectingRects.clear();
        }
        public function get created():Boolean{
            return (this.m_created);
        }
        public function get dirtyRects():DLinkedList{
            return (this.m_dirtyRects);
        }
        public function addDirtyRect(_arg1:Rectangle, _arg2:Boolean=false):void{
            var _local3:Rectangle;
            var _local4:Rectangle;
            var _local5:Boolean;
            var _local6:Boolean;
            var _local7:DListNode;
            var _local8:DListIterator;
            if (!_arg2){
                this.m_dirtyRects.append(_arg1);
            } else {
                _local3 = _arg1.clone();
                _local5 = false;
                _local6 = false;
                while (!(_local5)) {
                    _local7 = this.m_dirtyRects.head;
                    while (_local7) {
                        _local4 = _local7.data;
                        if (_local3.intersects(_local4)){
                            _local3 = _local4.union(_local3);
                            _local8 = new DListIterator(this.m_dirtyRects, _local7);
                            _local8.remove();
                            _local6 = true;
                            break;
                        };
                        _local7 = _local7.next;
                    };
                    if (!_local6){
                        this.m_dirtyRects.append(_arg1);
                        _local5 = true;
                    };
                };
            };
        }
        public function markDirtyRegion(_arg1:PositionedObject, _arg2:Rectangle):void{
        }
        public function intersectDirtyRegion(_arg1:PositionedObject, _arg2:Rectangle):int{
            this.m_numIntersectingRects = 0;
            return (this.m_numIntersectingRects);
        }

    }
}//package blit 
